package q1.project.modules.system.dept.provider;

import java.util.List;
import java.util.Optional;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import q1.project.modules.system.dept.entity.DeptEntity;
import q1.project.modules.system.dept.model.DeptQueryVm;
import q1.project.modules.system.dept.service.DeptService;

/**
 * 部门对外服务提供者
 *
 * @author Q1 Team
 * @version 1.0
 */
@Service
@RequiredArgsConstructor
public class DeptProvider {

  private final DeptService deptService;

  public Optional<DeptEntity> getDeptById(String id) {
    return deptService.getById(id);
  }

  public Optional<DeptEntity> getDeptByCode(String deptCode) {
    return deptService.getByCode(deptCode);
  }

  public List<DeptQueryVm.Result> getDeptTree() {
    return deptService.queryTree();
  }

  public List<DeptQueryVm.Result> getDeptChildren(String parentId) {
    return deptService.queryChildren(parentId);
  }
}
